package basis

import (
	"gorm.io/plugin/soft_delete"
	"xkginweb/global"
)

// 基础项表

type QccBasis struct {
	BasisId   uint                  `gorm:"primary_key;AUTO_INCREMENT;comment:主键ID" json:"basis_id"`
	CreatedAt global.LocalTime      `gorm:"type:datetime;comment:创建时间" json:"created_at"`
	UpdatedAt global.LocalTime      `gorm:"type:datetime;comment:更新时间" json:"updated_at"`
	IsDeleted soft_delete.DeletedAt `gorm:"type:bigint(20) unsigned;default:0;comment:是否删除" json:"is_deleted"`
	BasisName string                `gorm:"type:varchar(50);comment:基础项;NOT NULL" json:"basis_name"`
	RoomId    uint                  `gorm:"type:bigint(20);comment:房间id;NOT NULL" json:"room_id"`
	QccRoom   *QccRoom              `gorm:"foreignKey:RoomId;references:room_id;" json:"room"`
	Type      string                `json:"type" gorm:"not null;default:'';comment:检查类型"`
}

type QccBasisList struct {
	BasisId   uint   `gorm:"primary_key;AUTO_INCREMENT;comment:主键ID" json:"basis_id"`
	BasisName string `gorm:"type:varchar(50);comment:基础项;NOT NULL" json:"basis_name"`
	RoomId    uint   `gorm:"type:bigint(20);comment:房间id;NOT NULL" json:"room_id"`
	Type      string `json:"type" gorm:"not null;default:'';comment:检查类型"`
}

func (QccBasis) TableName() string {
	return "qcc_basis"
}

type QccRoom struct {
	RoomId   uint   `json:"room_id" gorm:"primarykey;comment:主键ID"` // 主键ID
	RoomName string `json:"room_name" gorm:"not null;default:'';comment:房间名"`
	RoomType int8   `json:"room_type" gorm:"not null;default:0;comment:房间类型 1进线房 2机房"`
}
